get Sale Gains For Date Range
Calculates and returns CapitalGainResult containing the grand total of all fields within the date requested. Notes: - Gains flagged as invalid will be skipped when calculating totals - The result's isValid property will be false if the security account's cost basis is invalid. - Values are normally returned in the security account's parent (investment) account's currency. You should not directly convert these returned totals to another currency, as gains should normally be converted individually to another currency using that gain's txn date. - optionally pass the targetCurrency for each gain to be converted into (using the gain's txn's date). - The method of calculating / totalling the value/basis/gain/LT/ST and conversion to target currency mirror the CapitalGainsReport for consistancy. - refer valuationDate - when enabled, then constant currency mode is enabled and results will mirror the InvestmentPerformanceReport for consistancy.
Return
returns CapitalGainResult result which contains totals for the gains within the range, optionally converted to the target currency.
Parameters
specify the date range to filter gains (should not end after the asof date!)
Default null to use the security account's parent (investment) account's currency, or specify to convert each gain to the target currency (as of the txn's date)
Default null to (re)value / currency convert each gain using the gain's txn date. Specify a date to (re)value each gain using valuationDate - i.e. constant currency methodology
Default false: a sale is selected when its transaction date falls within dateRange. When true: a sale is selected when its tax date falls within dateRange, whatever its transaction date. Sales dated after the range end are then read up to this calculation's as-of date only, so the caller must build the calculation to a late enough as-of date (refer deriveTxnDateRangesForTaxDates). Requires useTaxDate and no unRealizedSaleTxn: throws IllegalArgumentException when true and this calculation was built without useTaxDate, or with an unRealizedSaleTxn. Same selection as getListGainsForDateRange. The parameter was added @since MD2027